home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 2.1 KB | 70 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: ODFCWProfilerLib.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993-1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
-
- #ifndef __CODEFRAGMENTS__
- #include <CodeFragments.h>
- #endif
-
- #ifndef FWPROFILER_H
- #include "FWProfiler.h"
- #endif
-
- #ifndef __PROFILER__
- #include <Profiler.h>
- #endif
-
- #ifndef _STDLIB
- #include <stdlib.h>
- #endif
-
- //========================================================================================
- // Prototypes
- //========================================================================================
-
- extern "C" pascal OSErr ODF_CWPROFLIB_CFMINIT(CFragInitBlockPtr initBlkPtr);
- extern "C" pascal void ODF_CWPROFLIB_CFMTERM(void);
- extern "C" short __initialize(void);
- extern "C" void __terminate(void);
-
- //========================================================================================
- // Initialization methods
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // ODF_LIBRARY_CFMINIT (Has to be upper case because of the 68K Linker)
- //----------------------------------------------------------------------------------------
-
- extern "C" pascal OSErr ODF_CWPROFLIB_CFMINIT(CFragInitBlockPtr)
- {
- // Shared libraries don't get their static objects initialized correctly without
- // calling __initialize or __CPlusInit for MetroWerks or MrC respectively.
- __initialize();
-
- OSErr profilerErr = ProfilerInit(collectDetailed, bestTimeBase, 100, 20);
- if (profilerErr == noErr)
- ProfilerSetStatus(false); // default to explicit profiling
-
- return profilerErr;
- }
-
- //----------------------------------------------------------------------------------------
- // ODFCFMTERM
- //----------------------------------------------------------------------------------------
-
- extern "C" pascal void ODF_CWPROFLIB_CFMTERM(void)
- {
- if (FW_ProfilerGetStatus())
- FW_ProfilerDump();
-
- ProfilerTerm();
-
- __terminate();
- }
-